 <template>
	<n-page :loading="false" loading-gif="https://dnvue.dengqichang.cn/file/imgs/loading.gif">
		<view slot="navbar"></view>
		<view slot="header">
			<view class="fixed1" style="width: 100%;z-index: 9;">
				<view class="bg-gray-1">
					<view class="flex-row justify-between bg-red-7 padding-sm" :style="'background-image:url(' + $util.img('upload/uniapp/point/head_bg.png') + ');background-repeat: no-repeat;background-position: bottom right; background-size: 150rpx;'">
						<view class="flex-row items-center padding-sm">
							<n-icon name="attention" color="$gray-1" size="38"></n-icon>
							<text class="color-gray-1 text-xl margin-left-xs">{{ memberAccount.junzheng_ticket ? parseInt(memberAccount.junzheng_ticket) : 0 }}</text>
						</view>
						<view class="padding-sm text-right">
							
						</view>
					</view>
				</view>
				<view class="bg-gray-1 padding-y-sm margin-top-xs border-bottom-xs border-solid border-gray-4" style="border: 0;">
					<view class="padding-x-sm">
						<text class="margin-left-xs">君政卷明细</text>
					</view>
				</view>
			</view>
		</view>
		<view slot="body" style="height: 100%;">
			
			<z-paging ref="paging" @query="getData" :list.sync="dataList" enable-back-to-top>
				<view slot="loading">
					<ns-loading></ns-loading>
				</view>
				<view class="bg-gray-1">
					<view class="padding-x-md border-bottom-xs border-dotted border-gray-5" style="border-top-width:0;border-left-width:0;border-right-width:0" v-for="(item, index) in dataList" :key="index">
						<view class="flex-row items-center padding-y-xs">
							<view class="margin-right-md">
								<n-icon v-if="item.account_data>0" name="pulldown" color="$red-6" size="70"></n-icon>
								<n-icon v-else name="pullup" color="$green-6" size="70"></n-icon>
							</view>
							<view class="flex-column flex-1">
								<view class="flex-row justify-between">
									<view class="text-md text-bold">{{ item.type_name }}</view>
									<view class="text-md color-red-6" v-if="item.account_data > 0">
										+{{ parseInt(item.account_data) }}
									</view>
									<view class="text-lg color-gray-8" v-else>{{ parseInt(item.account_data) }}</view>
								</view>
								<view class="text-xs color-gray-7">
									<text>{{ item.remark }}</text>
								</view>
								<view class="text-xs color-gray-7">
									<text>{{ $util.timeStampTurnTime(item.create_time) }}</text>
								</view>
							</view>
						</view>
					</view>
				</view>	
			</z-paging>
		</view>
	</n-page>
 </template>
 <script>
 import globalConfig from '@/common/js/golbalConfig.js'
 export default {
 	data() {
 		return {
 			memberAccount: {
 				junzheng_ticket: 0
 			},
 			dataList: []
 		};
 	},
 	mixins:[globalConfig],
 	onShow() {
 		this.$langConfig.refresh();
 		if (!uni.getStorageSync('token')) {
 			this.$util.redirectTo(
 				'/pages/login/login/login',
 				{
 					back: '/otherpages/member/point/point'
 				},
 				'redirectTo'
 			);
 		}
 		this.getAccountInfo();
 	},
 	methods: {
 		toList(){
 			this.$util.redirectTo('/promotionpages/point/list/list');
 		},
 		toOrderList(){
 			this.$util.redirectTo('/promotionpages/point/order_list/order_list');
 		},
 		//获取个人积分信息
 		getAccountInfo() {
 			this.$api.sendRequest({
 				url: '/api/memberaccount/info',
 				data: {
 					account_type: 'junzheng_ticket'
 				},
 				success: res => {
 					if (res.code == 0 && res.data) {
 						this.memberAccount = res.data;
 					} else {
 						this.$util.showToast({ title: res.message });
 					}
 				}
 			});
 		},
 		//获得列表数据
 		getData(pageNo, pageSize) {
 			this.$api.sendRequest({
 				url: '/api/memberaccount/page',
 				data: {
 					page_size: pageSize,
 					page: pageNo,
 					account_type: 'junzheng_ticket'
 				},
 				success: res => {
 					let newArr = [];
 					let msg = res.message;
 					if (res.code == 0 && res.data) {
 						newArr = res.data.list;
 					} else {
 						this.$util.showToast({ icon:'none',title: msg });
 					}
 					this.$refs.paging.complete(newArr);
 				},
 				fail: res => {
 					this.$refs.paging.complete(false);
 				}
 			});
 		}
 	}
 };
 </script>

 <style lang="scss">

 </style>
